/**
 * 
 */
package group.anglers.om.core.persistence;


import java.io.InputStream;
import java.util.List;

import group.anglers.om.core.exceptions.OmException;


/**
 * @author an.pham
 * 
 */
public interface Persistence {
	/**
	 * 
	 * @param model
	 * @throws OmException
	 */
	public void insert(Object model) throws OmException;
	/**
	 * 
	 * @param model
	 * @throws OmException
	 */
	public void update(Object model) throws OmException;
	/**
	 * 
	 * @param model
	 * @throws OmException
	 */
	public void delete(Object model) throws OmException;
	/**
	 * 
	 * @param primaryKey
	 * @param modelClass
	 * @return
	 * @throws OmException
	 */
	public <T> T findByPK(Object primaryKey, Class<T> modelClass) throws OmException;
	
	public <T> List<T> findAll(Class<T> modelClass) throws OmException;
	/**
	 * 
	 * @param sql
	 * @param modelClass
	 * @return
	 */
	public <T> Query<T> createQuery(String sql, Class<T> modelClass) throws OmException;
	/**
	 * 
	 * @param inputStream
	 * @throws OmException
	 */
	public void executeBatch(InputStream inputStream) throws OmException;
	/**
	 * 
	 * @throws OmException
	 */
	public void flush() throws OmException;
	/**
	 * 
	 * @throws OmException
	 */
	public void startTransaction() throws OmException;
	/**
	 * 
	 * @throws OmException
	 */
	public void commitTransaction() throws OmException;
	/**
	 * 
	 * @throws OmException
	 */
	public void rollbackTransaction() throws OmException;
}
